﻿@using System.Collections
@using System.Web.Mvc.Html
@{
    ViewBag.Title = new RBS.Core.BLL.Siteconfig().loadConfig().webname;
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<link href="@Url.Content("~/Content/skin1/homeindivi.css")" rel="stylesheet" />
<script src="~/Scripts/Raty/jquery.raty.min.js"></script>
<style type="text/css">
    body {
        background: #f9f9f9 url(Content/skin1/images/bdby.gif) repeat-x left top;
    }
</style>
<div id="content">
    <div class="advandsns">
        @{
            @Html.Partial("_Adv");
        }
        <div class="hometopsns">
            <ol>
                <li class="sub1">
                    <h2><strong>呷饭网</strong>上海站</h2>
                    <a>微信号：yitaoshifu</a></li>
                <li class="sub2">
                    <h2><strong>点评</strong></h2>
                    <a>您可点评最近消费过的商家</a></li>
                <li class="sub3">
                    <h2><strong>呷饭网</strong>上海站</h2>
                    <wb:follow-button uid="5365099325" type="red_3" width="100%" height="24"></wb:follow-button>
                </li>
            </ol>
        </div>
    </div>
    <div class="hotelcategory">
        <ul>
            <li class="sub1"><a href="javascript:;">江浙菜</a></li>
            <li class="sub2 "><a href="javascript:;">粤菜</a></li>
            <li class="sub3"><a href="javascript:;">川湘菜</a></li>
            <li class="sub4"><a href="javascript:;">鲁菜</a></li>
            <li class="sub5"><a href="javascript:;">京菜</a></li>
            <li class="sub6"><a href="javascript:;">东北菜</a></li>
            <li class="sub7"><a href="javascript:;">西北菜</a></li>
            <li class="sub8"><a href="javascript:;">云贵菜</a></li>
            <li class="sub9"><a href="javascript:;">台湾菜</a></li>
            <li class="sub10"><a href="javascript:;">其他菜系</a></li>
        </ul>
    </div>
    <div class="hotellist">
        <h2 id="allHotel">全部</h2>
        <div class="hotelorderby">
            <select name="orderby" id="orderby" size="1">
                <option value="0">默认排名</option>
                <option value="1">按综合得分</option>
                <option value="2">按消费水平</option>
                <option value="3">按距离远近</option>
            </select>
        </div>
        <!--酒店加载-->
        <ol id="hotellistUL">
        </ol>
    </div>
</div>
 <!--酒店加载模版-->
<script type="text/template" id="HotelTemp">
    <li style="cursor: pointer;" onclick="javascript: window.location ='/Store/Index/{{Id}}'">
        <img src="{{Img}}" alt="{{Name}}" onerror="javascript:this.src='@Url.Content("~/Content/noPic.png")';" />
        <h3>{{Name}}</h3>
        <div class="score">
            <dfn>评分：</dfn>
            <b id="{{Id}}pf" data-score="{{Pingfen}}"></b> 
            <strong>{{Pingfen}}分</strong>
        </div>
        <div class="cuisine">
            <dfn>菜系：</dfn>{{Categories}}
        </div>
        <div class="average">
            <span class="l">¥<b>{{Renjun}}</b></span> 
        </div>
    </li>
</script>
 <!--友情链接-->
@{
    @Html.Partial("_Links"); 
}

<script type="text/javascript">
    $(function () {
        //初始化
        addHotel("");
        Init();
        // $(".hotelcategory li :first").addClass("active");
        $(".hotelcategory li").each(function () {
            $(this).click(function () {
                $(".hotelcategory li").removeClass("active");
                $(this).addClass("active");
                addHotel($(this).text());
                var url = "@Url.Action("List", "Store")?category=" + encodeURIComponent($(this).text());
                $("#allHotel").html("<a href='" + url + "'>全部</a>");
            });
        });
    });
    function addHotel(category) {
       
        var url = "@Url.Action("HotHotel")?category=" + encodeURIComponent(category) + "&sort=" + $('#orderby').children('option:selected').val() + "&cityName=" + $("#city").html();
        $.ajax({
            url: url,
            type: 'Post',
            dataType: 'json',
            success: function (result) {
                $("#hotellistUL").empty();
                if (result.Data == null)
                    return;
                $("#hotellistUL").html("");
                $.each(result.Data, function (index, row) {
                    var template = $('#HotelTemp').html();
                    var bookData = Mustache.render(template, row);
                    $("#hotellistUL").append(bookData);
                    var id = row["Id"];
                    raty(id + "pf");
                });
            }
        });
    }
    function Init() {
        //排序 
        $('#orderby').change(function () {
            addHotel($(".active").text());
        });
    }
    function raty(id) {
        $('#' + id).raty({
            readOnly: true,
            score: function () {
                return $(this).attr('data-score');
            }
        });
    }
</script>
